package com.fenghongzhang.broadcasttest;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.TextView;



public class MyReceiver extends BroadcastReceiver {


    private Handler handler;
//    private TextView textView;

    public MyReceiver(Handler handler) {
        this.handler = handler;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if(action.equals("com.feng")){

            final Bundle extras = intent.getExtras();
            final String name1 = extras.getString("name");
//            Message obtain = Message.obtain();
//            obtain.obj= name1;
//            handler.sendMessage(obtain);

            Intent intent1 = new Intent(context, Main5Activity.class);
            intent1.putExtra("name", name1);
            context.startActivity(intent1);


        }
    }
}
